package satir.command;

import satir.SatirGame;
import satir.SatirTherapy;
import satir.framework.command.RegularCommand;
import satir.framework.command.State;
import satir.framework.packaging.Packager.PackageExtractDestinactionWriteFailure;
import satir.framework.packaging.Packager.PackagerArchieveFileDestinationNotFoundException;
import satir.framework.packaging.Packager.PackagerArchieveFileToBeArchievedNotFoundException;
import satir.framework.packaging.Packager.PackagerArchieveZipFileWriteFailureException;
import satir.framework.packaging.Packager.PackagerExtractAchieveFileContentInvalidException;

/**
 * The Class PlaySatirGameCmd.
 * @version 3.0 April 2012
 * @author Creative Family
 */
public class PlaySatirGameCmd implements RegularCommand {

    /**
     * Execute to start Satir game.
     */
    @Override
    public void execute() {
	SatirGame game = SatirGame.getInstant(true);
	try {
	    if(SatirTherapy.isTestMode())
		game.setToTestMode();
	    game.startGame();
	} catch (PackagerExtractAchieveFileContentInvalidException e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	} catch (PackageExtractDestinactionWriteFailure e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	} catch (PackagerArchieveFileDestinationNotFoundException e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	} catch (PackagerArchieveFileToBeArchievedNotFoundException e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	} catch (PackagerArchieveZipFileWriteFailureException e) {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
	}
    }

    /* (non-Javadoc)
     * @see satir.framework.command.RegularCommand#execute(satir.framework.command.State)
     */
    @Override
    public void execute(final State state) {
	execute();
    }

    /**
     * Gets the instruction.
     * @return instruction
     */
    @Override
    public String getInstruction() {
	return "Play game.";
    }

}
